/* 
 * @JUDGE_ID:  1000AA  100  C  "Easy algorithm"
 * solution to problem 1, Duke ACM Internet programming constest
 * by: Owen Astrachan
 * date: 10/19/90
 * File:   Example.c
 * Author: Cesar Augusto Meneses Guzman
 *
 * Created on October 19, 1990, 12:03 PM
 */
#include <stdio.h>

/* return number of elements in the 3n+1 cycle for m */
int cycle(int m) {
    int i = 1;

    while (m != 1) {
        if (m % 2 == 0) {
            m = m / 2;
        } else {
            m = 3 * m + 1;
        }
        i = i + 1;
    }
    return i;
}

int mainC() {
    int m, n, max, temp;
    int mOriginal, nOriginal;
    int i;

    while (scanf("%d %d\n", &m, &n) == 2) {

        /* remember original order of entries for output */
        mOriginal = m;
        nOriginal = n;

        /* swap if out of order */
        if (m > n) {
            temp = m;
            m = n;
            n = temp;
        }

        max = cycle(m);
        for (i = m + 1; i <= n; i++) {
            temp = cycle(i);
            if (temp > max)
                max = temp;
        }
        printf("%d %d %d\n", mOriginal, nOriginal, max);
    }
    return (0);
}
